package vn.sunnet.game.SinhTon.object;

import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class MoveLetters extends DynamicGameObject {
	private TextureRegion texure;
	private boolean isStart;
	private float alpha;
	public MoveLetters(int x, int y, int width, int height, TextureRegion texure) {
		super(x, y, width, height);
		this.setTexure(texure);
		alpha = 0;
	}

	public TextureRegion getTexure() {
		return texure;
	}

	public void setTexure(TextureRegion texure) {
		this.texure = texure;
	}

	public boolean isStart() {
		return isStart;
	}

	public void setStart(boolean isStart) {
		this.isStart = isStart;
	}

	public void moveUp(float time) {
		if(getAlpha() >= 1)
			alpha = 1;
		else
			alpha -= time;
		
		if (position.y >= 220) {
			position.y = 220;
		} else {
			position.add(0, 10 * time);
		}

		bounds.x = position.x - bounds.width / 2;
		bounds.y = position.y - bounds.height / 2;
	}

	public void moveLeft(float time) {
		if (position.x <= 416) {
			position.x = 416;
		} else {
			position.add(-30 * time, 0);
		}

		bounds.x = position.x - bounds.width / 2;
		bounds.y = position.y - bounds.height / 2;
	}

	public void moveRight(float time) {
		if (position.x >= 294) {
			position.x = 294;
		} else {
			position.add(30 * time, 0);
		}

		bounds.x = position.x - bounds.width / 2;
		bounds.y = position.y - bounds.height / 2;
	}

	public float getAlpha() {
		return alpha;
	}
	
}
